import request from '@/utils/request'

const baseURL = process.env.VUE_APP_BASE_API

// 查询留言列表
export function listMessage(query) {
  return request({
    url: '/operate/message/list',
    method: 'get',
    params: query
  })
}

// 查询留言详细
export function getMessage(id) {
  return request({
    url: '/operate/message/' + id,
    method: 'get'
  })
}

// 新增留言
export function addMessage(data) {
  return request({
    url: '/operate/message',
    method: 'post',
    data: data
  })
}

// 修改留言
export function updateMessage(data) {
  return request({
    url: '/operate/message',
    method: 'put',
    data: data
  })
}

// 删除留言
export function delMessage(id) {
  return request({
    url: '/operate/message/' + id,
    method: 'delete'
  })
}


// 回复留言
export function replyMessage(data) {
  return request({
    url: '/operate/message/reply',
    method: 'put',
    data: data
  })
}

//结束留言
export function endMessage(id) {
  return request({
    url: '/operate/message/end/' + id,
    method: 'get'
  })
}


export function downloadMessageFile(url,fileName) {
  window.location.href = baseURL + "/common/download?url=" + encodeURI(url)  + "&fileName=" + fileName + "&delete=" + false;
}
